﻿using System.Collections;
using System.Collections.Generic;
using UnityEngine;
using UnityEngine.UI;
using Net.Messgae;

public class UIRoomPlayer : MonoBehaviour
{
    MatchPlayerInfo _info = null;

    public Text NameCom;
    public Toggle readyCom;

    public void UpdateData(MatchPlayerInfo info)
    {
        _info = info;

        readyCom.isOn = (int)MatchPlayerState.Ready == info.State;
        
        NameCom.text = info.OpenId;

        if(Model.Instance().playerModel.playerInfo != null 
            && info.OpenId == Model.Instance().playerModel.playerInfo.OpenId)
        {
            NameCom.text = "我";
        }

        gameObject.SetActive(true);
    }

    public void OnLeave()
    {
        _info = null;

        gameObject.SetActive(false);

    }

}
